#ifndef _VALUESETTINGSFORM_H
#define _VALUESETTINGSFORM_H

#include <QDialog>
#include "ui_valuesettingsform.h"
#include "../define.h"

class QLabel;
class QComboBox;
class QLineEdit;
class QPushButton;
class QFrame;
class QButtonGroup;

class ValueSettingsForm : public QDialog
{
	Q_OBJECT

public:
//	enum ValueFormType {
//		kVFTypeBias = 0,
//		kVFTypeMeasure
//	};

	ValueSettingsForm(const QString &item_name, 
					  const QString &current_range,
					  para_attr_e   range_attr,				  
					  const QString &lower_value,
					  const QString &upper_value,
					  int   master_kind = 0,
					  QWidget *parent = 0);
	~ValueSettingsForm();


	QString getRangeString();
	QString getLowerValue();
	QString getUpperValue();
	QString getUnitString();

private slots:
	void rangeChanged(const QString &range_string);
	void numberButtonsClicked();
	void spinButtonsClicked();
	void dialogShouldReturn();

private:
//	void setValues();
	void calculateValues();

	Ui_ValueSettingsForm ui;
	QPushButton  *okButton;
	QPushButton  *cancelButton;
	QComboBox    *rangeCombo;
	QFrame       *upperFrame;
	QLabel       *upperPointLabel;
	QLabel       *upperUnitLabel;
	QPushButton  *upperIntPlus;
	QPushButton  *upperIntMinus;
	QPushButton  *upperFraPlus;
	QPushButton  *upperFraMinus;
	QLineEdit    *upperIntEdit;
	QLineEdit    *upperFraEdit;
	QFrame       *lowerFrame;
	QLabel       *lowerPointLabel;
	QLabel       *lowerUnitLabel;
	QPushButton  *lowerIntPlus;
	QPushButton  *lowerIntMinus;
	QPushButton  *lowerFraPlus;
	QPushButton  *lowerFraMinus;
	QLineEdit    *lowerIntEdit;
	QLineEdit    *lowerFraEdit;
	QPushButton  *deleteButton;
	QButtonGroup *numberButtons;

	para_attr_e the_range_attr;
	double hilimit_value;
	double lowlimit_value;
	double step_value;
	double the_lower_value;
	double the_upper_value;
	int master_kind_;
};


inline QString ValueSettingsForm::getLowerValue()
{
	return QString::number(the_lower_value);
}


inline QString ValueSettingsForm::getUpperValue()
{
	return QString::number(the_upper_value);
}


#endif // _VALUESETTINGSFORM_H
